<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="./js/vue.js"></script>
    <div id='app'>
        <input type="text" v-model="msg" />
        {{msg|upperCase|asterisk}}
    </div>

    <div id='app2'>
        <input type="text" v-model="msg" />
        {{msg|upperCase|asterisk}}<!--报错，因为在app2中没有定义任何过滤器-->
    </div>

    <script>
        Vue.filter('',)
        Vue.filter('',)

        let app = new Vue({
            el: "#app",
            data: {
                msg: ''
            },
            filters: {//局部过滤器
                upperCase: function (val) {
                    return val.toUpperCase();
                },
                asterisk: function (val) {
                    var reg = /\d/g;
                    return val.replace(reg, '*');
                }
            }
        })
        let app2 = new Vue({
             el: '#app2',
             data:{
                    msg:''
             }
         })
    </script>
</body>

</html>